package com.yue.procress.get;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.yue.bean.json.Config;
import org.junit.Test;

import java.io.IOException;
import java.util.Map;

/**
 * Created by qiuyang on 2017/6/8.
 */
public class GetJson {

    @Test
    public void getJsonFromFile() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            Config config = objectMapper.readValue(GetJson.class.getClassLoader().getResourceAsStream("config.json"), Config.class);
            System.out.println(config);


//            Map<String, Object> mapJson = objectMapper.readValue(GetJson.class.getClassLoader().getResourceAsStream("config.json"), Map.class);
//            System.out.println(mapJson);
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
